<template>
<div class="runmode">
    <el-select v-model="value"  placeholder="Select" style="width: 240px" >
    <el-option
      v-for="item in options"
      :key="item.value"
      :label="item.label"
      :value="item.value"
    />
  </el-select>
  <el-button type="primary" style="margin: 20px;" @click="onSubmit">模式下发</el-button>
</div>    

</template>
<script setup>
import { ref } from 'vue'
import axios from 'axios'

const props = defineProps({
    Sval: {
        type: Object
    },
    Cval: {
        type: Object
    }
}
)

function onSubmit() {
  console.log(props.Sval,props.Cval,value.value)

  axios.post('/api/station/set',{
        Sval:props.Sval,
        Cval:props.Cval,
        Type:" RunMode",
        Option:value.value,

    }).then(res => {
        console.log(res)
    }).catch(err => {
        console.log(err)
    })
}

const value = ref('')
const options = [
  {
    value: '0',
    label: '手动模式',
  },
  {
    value: '1',
    label: '自动模式',
  },
  {
    value: '2',
    label: '代理模式',
  },
  {
    value: '3',
    label: '维护模式',
  },
]
</script>
<style  scoped>
.runmode{
    margin: auto;
    width: 50%;
}

</style>
